﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.utils.pool {
    import __AS3__.vec.*;
    import flash.errors.*;

    public class GenericPool implements IGenericPool {

        private var pool:Vector.<IPoolable>;

        public function GenericPool(){
            this.pool = new Vector.<IPoolable>();
        }
        public function allocateObject():IPoolable{
            if (this.pool.length == 0){
                return (this.createObject());
            };
            return (this.pool.pop());
        }
        public function recycle(_arg1:IPoolable):void{
            _arg1.reset();
            this.pool.push(_arg1);
        }
        public function createObject():IPoolable{
            throw (new IllegalOperationError("You cannot call this method directly, subclass and override the method"));
        }
        public function flush():void{
            this.pool = new Vector.<IPoolable>();
        }

    }
}//package net.wooga.pets.utils.pool 
